Copyright: (C) 1996-1997 Visio Corporation
Citation: (C) 1996-1997 Visio Corporation


Object-Role Modeling Template

  In this topic

The Object-Role Modeling Template includes all the shapes you need to use the object-role modeling method to design databases. Object-role modeling (ORM) is a semantic modeling approach that describes the world in terms of objects playing roles.

For details about Object-Role Modeling, see Conceptual Schema and Relational Database Design, 2nd edition, by Terry Halpin (Australia: Prentice Hall, 1995).

Before you draw an ORM diagram

Before you begin to model a database, express the information you want the database to include in simple sentences that describe what objects exist, how the objects are identified, and the roles they play. It's helpful to format objects in italics and relationships between objects in bold.

You can use these sentences as the basis for the model you draw.

Adding and naming objects

Objects in ORM models are represented by Entity shapes, which are ellipses with a solid outline. You name each entity and identify how it is referenced, by a name or by a code. For example, if Employee is the entity name, you can reference an employee using an employee number, which is a code, or employee name.

To add and name an object:

1.	Drop an Entity shape on the drawing page.

2.	While the shape is selected, type the entity name.

3.	Press Enter, then type the entity reference mode in brackets.

Adding and naming values

Values in ORM notation are represented by ellipses with a dashed outline. Values help to identify entities.

To add and name a value:

1.	Drop a Value shape on the drawing page.

2.	While the shape is selected, type the value name.

Subtyping

You can indicate that one entity is a subtype of another by connecting the two entities with a subtype arrow. The arrowhead points to the entity from the subtype entity.

To indicate a subtype:

•	Glue the plain endpoint of a Subtype Connector to the subtype entity. Glue the arrowhead endpoint to the other entity.

Indicating relationships

In ORM notation, relationships (also called facts) between entities and relationships (also called references) between entities and values are represented by roles.

Roles function as predicates (in relation to objects, or entities, which are subjects) and can be made up of one or more role boxes. The ORM stencil in Visio includes five Predicate shapes-Unary, Binary, Vertical Binary, Ternary, Quarternary-that include different numbers of role boxes. The predicate shape you use  depends on the number of entities you want to relate.

Use the Ternary predicate shape to indicate relationships among three entities.

Use the Binary predicate shape to indicate a relationship between an entity and value.

To indicate a relationship between entity shapes:

1.	Glue one endpoint of a Role Connector to each entity shape that you want to define a relationship for.

2.	Drop a Predicate shape with enough role boxes to relate all the entity shapes.

For example, drop a Ternary shape to indicate relationships among three entities.

3.	Glue the free endpoints of the role connectors to the appropriate role boxes on the n-ary predicate shape.

4.	Double-click the predicate shape. Place the cursor between ellipses (or placeholders), then type a name for the role an entity plays.

To indicate a relationship between an entity and a value:

1.	Glue one endpoint of a Role Connector to the entity shape, then glue one endpoint of another Role Connector to the value shape.

2.	Drop a Binary or Vertical Binary shape on the drawing page and glue the free endpoints of the connectors to the ends of the shape.

3.	Double-click the binary. Place the cursor between ellipses, or placeholders, then type a name for the role an entity plays.

Tip: You can change which side of a Vertical Binary shape ellipses and names are on by flipping the shape horizontally.

Showing a nested object

In ORM diagrams, you can treat relationships between objects as objects themselves. ORM models indicate these nested objects, also called objectified predicates, by placing a frame with rounded corners around the appropriate predicate.

To create an objectified predicate:

1.	Choose the rectangle tool from the Standard toolbar.

2.	Draw a rectangle around the predicate shape you want to identify as an objectified predicate.

3.	With the rectangle selected, choose Shape > Send To Back.

4.	Choose the third option from the Corner Rounding palette on the Shape toolbar to round the corners of the rectangle.

Indicating manadatory role constraints

When a role is mandatory, evey member of the object type represented by the entity must play the role. You can indicate a mandatory role constraint by using the Mandatory Role connector.

To indicate a mandatory role:

•	Drop a Mandatory Role connector and glue the endpoint with the black circle to the entity shape and the other endpoint to a predicate shape.

Indicating uniqueness constraints

You indicate uniqueness constraints by placing double-headed arrows above or below role boxes on n-ary predicate shapes.

To indicate a uniqueness constraint:

•	Drop a Uniqueness Constraint shape above or below the role(s) you want to constrain, then drag one of the arrow's endpoints so that the arrow stretches across the appropriate roles.

Indicating occurrence frequency constraints

You indicate that each instance of a role occurs exactly n times by placing the number n beside the role.

To indicate a frequency constraint:

1.	Drop a Frequency Constraint shape near the role you want to constrain.

2.	With the shape selected, type the frequency you want.

Indicating set comparison and equality contraints

You indicate subset and equality constraints by connecting role boxes on n-ary predicates with arrows.

To indicate a set comparison or equality constraint:

1.	Drop a Subset Constraint or Equality Constraint shape between the n-ary predicates with roles you want to constrain.

2.	Glue one endpoint of the constraint shape to the appropriate role box on each n-ary predicate.

Indicating ring constraints

Ring constraints apply when the same object type plays two roles in a predicate. You indicate a ring constraint by placing a ring-shaped symbol above a role box. You can indicate a constraint type by adding two-letter abbreviations beside the symbol. For example, "ir" indicates an irreflexive constraint and "as" indicates an asymmetric constraint.

To indicate a ring constraint:

1.	Drop a Ring Constraint shape on the drawing page near the n-ary predicate containing the two roles you want to constrain.

2.	If the two roles are part of a longer predicate, glue each endpoint on the Ring Constraint shape line to one of the roles.

If the two roles are a binary predicate, select the Ring Constraint shape, then choose No Line from the Line color palette on the Shape toolbar.

3.	Double-click the shape. Place the cursor to the right of the ring-shaped symbol, then type the two-letter abbreviation for the constraint you want.

Indicating external constraints

You indicate external constraints by connecting a symbol representing a constraint to the roles the constraint effects.

To create an external constraint:

1.	Drop the symbol shape representing the external constraint you want to add on the drawing page near the n-ary predicates representing the roles you want to constrain.

2.	Drop a Constraint Connector, then glue one endpoint to the external constraint and the other endpoint to each appropriate role box in the n-ary predicates.


Before you draw an ORM diagram

Adding and naming objects

Adding and naming values

Subtyping

Indicating relationships

Showing a nested object

Indicating mandatory role constraints

Indicatory uniqueness constraints

Indicating occurrence frequency constraints

Indicating ring constraints

Indicating external constraints